package model

type BaseMessage struct {
	msgID    byte   //消息ID
	reserved byte   //消息头保留位
	dataLen  uint32 //消息的长度
	msgData  []byte //消息的内容
}

func NewBaseMessage() *BaseMessage {
	return &BaseMessage{}
}
func NewEmptyBaseMessage() *BaseMessage {
	return &BaseMessage{
		0,
		0,
		0,
		[]byte{},
	}
}
func NewMsgIDBaseMessage(msgID byte) *BaseMessage {
	return &BaseMessage{
		msgID,
		0,
		0,
		[]byte{},
	}
}

func (m *BaseMessage) GetMsgId() byte {
	return m.msgID
}

func (m *BaseMessage) GetMsgLen() uint32 {
	return m.dataLen
}
func (m *BaseMessage) GetData() interface{} {
	return m.msgData
}

func (m *BaseMessage) SetMsgId(id byte) {
	m.msgID = id
}
func (m *BaseMessage) SetMsgLen(len uint32) {
	m.dataLen = len
}
func (m *BaseMessage) SetData(data interface{}) {
	m.msgData = data.([]byte)
}

func (m *BaseMessage) GetReserved() byte {
	return m.reserved
}
func (m *BaseMessage) SetReserved(reserved byte) {
	m.reserved = reserved
}
